package javacore.day10.AdapterSortNumber;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;


public class NumberSorter {
	public List<Integer> sort(int[] numberList2) {
		//List<Integer> abc = new ArrayList<Integer>();
		//abc = numberList;
		// abc.sort();
		
		List<Integer> numberList = new ArrayList<Integer>();
		for (int i = 0; i < numberList2.length; i++) {
			numberList.add(numberList2[i]);
		}
		Collections.sort(numberList,new IntegerComparator());
		return numberList;
	}
}
class IntegerComparator implements Comparator<Integer> {

	public int compare(Integer o1, Integer o2) {
		int age1 = o1;
		int age2 = o2;
		if (age1 > age2) {
			return 1;
		} else if (age1 == age2) {
			return 0;
		} else {
			return -1;
		}
	}
}
